﻿using System;
using System.Windows.Forms;
using System.Collections.Generic;
using INHollandair.Core.Models;
using INHollandair.Core.Services;

namespace INHollandair_log_application
{
    public partial class LogViewer : Form
    {
        public LogViewer()
        {
            InitializeComponent();
            EventLogService svc = new EventLogService();

            try
            {
                List<EventLog> events = svc.GetAllEventLogs();

                if (events.Count > 0)
                {
                    LogView.DataSource = events;
                    LogView.Columns[1].Width = 500;
                }
                else
                {
                    lbl_Title.Text = "De event log is momenteel leeg.";
                }
            }
            catch (Exception)
            {
                lbl_Title.Text = "Verbinding verbroken.";
                throw;
            }
            
        }
    }
}
